package burubaka.model;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;
import org.slim3.datastore.json.Json;

import com.google.appengine.api.datastore.Key;

/**
 * @author tk
 * 
 */
@Model(schemaVersion = 1)
public class PreRaceInfo implements Serializable {

	private static final long serialVersionUID = 1L;

	@Attribute(primaryKey = true, json = @Json(ignore = true))
	private Key key;

	@Attribute(version = true, json = @Json(ignore = true))
	private Long version;
	private String raceName;
	private String displayRaceName;
	private String raceDate;
	private String districtClass;
	private int execFlag = 0;

	/**
	 * Returns the key.
	 * 
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * Sets the key.
	 * 
	 * @param key
	 *            the key
	 */
	public void setKey(Key key) {
		this.key = key;
	}

	/**
	 * Returns the version.
	 * 
	 * @return the version
	 */
	public Long getVersion() {
		return version;
	}

	/**
	 * Sets the version.
	 * 
	 * @param version
	 *            the version
	 */
	public void setVersion(Long version) {
		this.version = version;
	}

	/**
	 * @param raceName
	 *            セットする raceName
	 */
	public void setRaceName(String raceName) {
		this.raceName = raceName;
	}

	/**
	 * @return raceName
	 */
	public String getRaceName() {
		return raceName;
	}

	public String getDisplayRaceName() {
		return displayRaceName;
	}

	public void setDisplayRaceName(String displayRaceName) {
		this.displayRaceName = displayRaceName;
	}

	/**
	 * @param raceDate
	 *            セットする raceDate
	 */
	public void setRaceDate(String raceDate) {
		this.raceDate = raceDate;
	}

	/**
	 * @return raceDate
	 */
	public String getRaceDate() {
		return raceDate;
	}

	public String getDistrictClass() {
		return districtClass;
	}

	public void setDistrictClass(String districtClass) {
		this.districtClass = districtClass;
	}

	/**
	 * @param execFlag
	 *            セットする execFlag
	 */
	public void setExecFlag(int execFlag) {
		this.execFlag = execFlag;
	}

	/**
	 * @return execFlag
	 */
	public int getExecFlag() {
		return execFlag;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((key == null) ? 0 : key.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		PreRaceInfo other = (PreRaceInfo) obj;
		if (key == null) {
			if (other.key != null) {
				return false;
			}
		} else if (!key.equals(other.key)) {
			return false;
		}
		return true;
	}
}
